package com.indobrains.uud1945;

import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;

import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;

public class ContentActivity extends Activity {
	private static final String PAGE_NO="PAGE_NO";
	private static final String PAGE_TITLE="PAGE_TITLE";
	private TextView title;
	private TextView content;
	String s_content;
	private int pageNo;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.content_layout);
		title=(TextView)findViewById(R.id.Title);
		content=(TextView)findViewById(R.id.textContent);
		Bundle b = getIntent().getExtras();
		pageNo = b.getInt(PAGE_NO);
		String stitle=b.getString(PAGE_TITLE);
		title.setText(stitle);
		switch(pageNo){
		case 0:
			s_content=getResources().getString(R.string.preface_content);
			content.setText(s_content);
			break;
		case 1:
			s_content=getResources().getString(R.string.preambule);
			content.setText(s_content);
			break;
		case 2:
			s_content=getResources().getString(R.string.about_content);
			content.setText(s_content);
			break;
		}
		AdView adView = new AdView(this, AdSize.BANNER, MainActivity.MY_AD_UNIT_ID);
        
        LinearLayout layout = (LinearLayout)findViewById(R.id.bannerLayout);
        
        layout.addView(adView);
         
        adView.loadAd(new AdRequest());
	}

}
